﻿using System;
using System.Collections.Generic;
using T4UtilityBelt.Serializers;

namespace T4UtilityBelt.Templates
{
    public abstract class ClassesToXsdTemplate : Template
    {
        public void RenderFiles(IEnumerable<Type> types)
        {
            XsdSerializer xs = new XsdSerializer();

            IEnumerable<Xsd> xsdList = xs.CreateXsd(types);

            foreach (var xsd in xsdList)
            {
                StartNewFile(xsd.Name + ".xsd");
                Write(xsd.Document.ToString());
            }

            ProcessFiles();
        }
    }
}